package com.lanou.utp.service.impl;

import com.lanou.utp.entity.Admin;
import com.lanou.utp.entity.Student;
import com.lanou.utp.entity.Teacher;
import com.lanou.utp.mapper.UserMapper;
import com.lanou.utp.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("userService")
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public Admin getAdmin(Integer id) {
        Admin admin = userMapper.getAdmin(id);
        admin.setRole(9);
        return admin;
    }

    @Override
    public Teacher getTeacher(Integer id) {
        return userMapper.getTeacher(id);
    }

    @Override
    public Student getStudent(Integer id) {
        Student student = userMapper.getStudent(id);
        student.setRole(4);
        return student;
    }
}
